package com.market.sys.config;

import com.market.sys.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    /**
     * 添加Web项目的拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 对所有访问路径，都通过MyInterceptor类型的拦截器进行拦截
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**")
                .excludePathPatterns("/common/**")
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/user/logout")
                .excludePathPatterns("/common/upload")
                .excludePathPatterns("/common/download")
                .excludePathPatterns("/user/logout")
                .excludePathPatterns("/sys/article/**")
                .excludePathPatterns("/sys/wxUser/**")
                .excludePathPatterns("/sys/comment/**")
                .excludePathPatterns("/sys/subComment/**")
                .excludePathPatterns("/sys/userLike/**")
                .excludePathPatterns("/sys/userCollection/**")
                .excludePathPatterns("/sys/province/**")
                .excludePathPatterns("/sys/booth/**")
                .excludePathPatterns("/sys/contract/**")
                .excludePathPatterns("/sys/notification/**")
                .excludePathPatterns("/sys/notice/**");
    }

}
